package com.capgemini.teamtwo.controller;

import javax.servlet.http.HttpSession;

public class BaseController {

    /**
     * 获取Session对象中的uid
     *
     * @param session session对象
     * @return 当前登陆的用户id的值
     */

    protected final Integer getIdFromSession(HttpSession session) {
        return Integer.valueOf(session.getAttribute("id").toString());
    }

    /**
     * 获取当前登陆的username
     *
     * @param session session对象
     * @return 当前登陆用户的用户名
     */
    protected final String getUsernameFromSession(HttpSession session) {
        return session.getAttribute("username").toString();
    }

}
